home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / mewin10s.zip / MSWIN.H < prev    next >
C/C++ Source or Header  |  1992-02-27  |  7KB  |  157 lines

  1. /* This file provides definitions for the C source and resource scripts
  2.    for support of operation under the Microsoft Windows environment on
  3.    an IBM-PC or compatible computer.
  4.  
  5.    Must be compiled with Borland C++ 2.0 or later version.
  6.  
  7.    It should not be compiled if the WINDOW_MSWIN symbol is not set */
  8.  
  9. /* compile flags */
  10. #define BLOCKCARET  1   /* 1 to have a cell-sized caret when within a
  11.                screen, 0 for a vertical bar */
  12. #define SUBALLOC    0   /* implement malloc/free/realloc by segment
  13.                suballocation routines (needed for Borland C
  14.                2.0, but not necessary under Borland C 3.0)
  15.                */
  16. #define MEMTRACE    1   /* adds a debugging trace to mswmem.c */
  17.  
  18. /* some tricks to avoid conflicts with estruct.h ... */
  19. #undef  FAR
  20. #undef  PASCAL
  21. #undef  NEAR
  22. #undef  HIBYTE
  23. #undef  CDECL
  24. #undef  VOID
  25. #define BITMAP MSWBMP   /* to avoid type redefinition */
  26.  
  27. #include    <windows.h>
  28.  
  29. #include    "mswrid.h"  /* contains all the Resource IDs */
  30.  
  31. /* macros */
  32. #define MLSIZE  NSTRING         /* message line buffer size */
  33.  
  34. /* offsets for the screen windows extra bytes */
  35. #define GWL_SCRPTR  0                   /* SCREEN structure pointer */
  36. #define GWW_SCRCX   (GWL_SCRPTR+sizeof(LONG))   /* client area width */
  37. #define GWW_SCRCY   (GWW_SCRCX+sizeof(WORD))       /* client area height */
  38. #define SCRWNDEXTRA (GWW_SCRCY+sizeof(WORD))
  39.  
  40. /* offsets for the frame window extra bytes */
  41. #define GWW_FRMID   0                   /* Id seen by other emacs apps */
  42. #define FRMWNDEXTRA (GWW_FRMID+sizeof(WORD))
  43.  
  44. /* structures */
  45. typedef struct  CellMetrics {   /* coordinate-related parameters of a font */
  46.     short   OffsetX, OffsetY;  /* offset of column 0 or row 0, relative
  47.                   to the client area upper left corner */
  48.     short   LeadingY, HalfLeadingY; /* external leading between rows */
  49.     short   SizeX, SizeY;       /* character cell size */
  50.     short   MLHeight;           /* height of the message line */
  51. } CellMetrics;
  52.  
  53. #ifdef  termdef     /* in mswdrv.c only */
  54. char    ProgName [] = PROGNAME;
  55. int     CurrentRow = 0;
  56. int     CurrentCol = 0;
  57. BOOL    MouseTracking = FALSE;
  58. BOOL    InternalRequest = FALSE;
  59.  
  60. /* Global uninitialized variables */
  61. HWND    hFrameWnd;          /* main (frame) window */
  62. HWND    hMDIClientWnd;      /* MDI client window */
  63. HANDLE  hEmacsInstance;     /* module instance */
  64. DWORD   WinFlags;           /* windows memory configuration */
  65. HCURSOR hScreenCursor, hTrackCursor, hNotQuiescentCursor, hHourglass;
  66. char    *ScreenClassName;   /* MDI childs class name */
  67. char    *MLBuf;             /* message line buffer */
  68. HFONT   hEmacsFont;         /* font used for display */
  69. CellMetrics     EmacsCM;    /* cell metrics of that font */
  70.  
  71. char    *MainHelpFile;      /* Emac's help file name and useage flag */
  72. BOOL    MainHelpUsed;
  73.  
  74. char    HelpEngineFile [NFILEN];/* user help file and useage flag */
  75. BOOL    ColorDisplay;       /* TRUE if the display is color-capable */
  76. #else
  77. extern char ProgName [];    /* used all over the place for captions,
  78.                    etc... */
  79. extern int  CurrentRow;
  80. extern int  CurrentCol;     /* caret positions (in text coordinates) */
  81. extern BOOL MouseTracking;  /* TRUE if mouse in tracking/dragging mode */
  82. extern BOOL InternalRequest;
  83.     /* TRUE for a request that originates from the mswxxx modules. This
  84.        is meant to avoid infinite recursions for requests that could
  85.        come from both MS-Windows or the editor's core (for instance
  86.        resizing, screen activation...) */
  87.  
  88. /* Global uninitialized variables */
  89. extern HWND    hFrameWnd;          /* main (frame) window */
  90. extern HWND    hMDIClientWnd;      /* MDI client window */
  91. extern HANDLE  hEmacsInstance;     /* module instance */
  92. extern DWORD   WinFlags;           /* windows memory configuration */
  93. extern HCURSOR hScreenCursor, hTrackCursor, hNotQuiescentCursor, hHourglass;
  94. extern char    *ScreenClassName;   /* MDI childs class name */
  95. extern char    *MLBuf;             /* message line buffer */
  96. extern HFONT   hEmacsFont;         /* font used for display */
  97. extern CellMetrics     EmacsCM;    /* cell metrics of that font */
  98.  
  99. extern char    *MainHelpFile;      /* Emac's help file name and useage flag */
  100. extern BOOL    MainHelpUsed;
  101.  
  102. extern char    HelpEngineFile [NFILEN];/* user help file and useage flag */
  103. extern BOOL    ColorDisplay;       /* TRUE if the display is color-capable */
  104. #endif
  105.  
  106. /* input stream access functions */
  107. void in_init (void);
  108. BOOL in_room (int n);
  109. BOOL in_check (void);
  110. void in_put (int event);
  111. int  in_get (void);
  112.  
  113. /* Windows-implementation specific functions */
  114. LONG EXPORT far pascal ScrWndProc (HWND hWnd, WORD wMsg, WORD wParam,
  115.                    LONG lParam);
  116. LONG EXPORT far pascal FrameWndProc (HWND hWnd, WORD wMsg, WORD wParam,
  117.                      LONG lParam);
  118. int far pascal GetInput (void);
  119. int far pascal TakeANap (int t);
  120.  
  121. void far pascal InitMenuPopup (HMENU hMenu, DWORD lParam);
  122. BOOL far pascal MenuCommand (WORD wParam, DWORD lParam);
  123. HMENU far pascal GetScreenMenuHandle (void);
  124.  
  125. BOOL far pascal EatKey (WORD MsgCode, WORD Key, DWORD lParam);
  126. void far pascal MouseMessage (HWND hWnd, WORD wMsg, WORD wParam, DWORD lParam);
  127.  
  128. void far pascal BuildCellMetrics (CellMetrics *cm, HFONT hFont);
  129. void far pascal InvalidateCells (HWND hWnd, int leftcol, int toprow,
  130.                                  int rightcol, int bottomrow);
  131. void far pascal MinimumClientSize (HWND hWnd, int NCols, int NRows,
  132.                    int *Width, int *Height);
  133. int far pascal DisplayableRows (HWND hWnd, int Height, CellMetrics *cm);
  134. int far pascal DisplayableColumns (HWND hWnd, int Width, CellMetrics *cm);
  135. void far pascal EmacsCaret (BOOL Show);
  136. void far pascal MoveEmacsCaret (HWND hWnd, int col, int row);
  137. void far pascal ShowEmacsCaret (BOOL Show);
  138. void far pascal CellToClient (HWND hWnd, POINT Cell, LPPOINT Client);
  139. void far pascal ClientToCell (HWND hWnd, POINT Client, LPPOINT Cell);
  140. void far pascal GetMinMaxInfo (HWND hWnd, LPPOINT rgpt);
  141. BOOL far pascal ScrReSize (HWND hWnd, WORD wParam, WORD cx, WORD cy);
  142. void far pascal ScrPaint (HWND hWnd);
  143. void far pascal MLPaint (void);
  144.  
  145. BOOL far pascal InMessageLine (void);
  146.  
  147. void far pascal ClipboardCleanup (void);
  148.  
  149. int far pascal SetWorkingDir (void);
  150.  
  151. void far pascal InitializeFarStorage (void);
  152. void far pascal JettisonFarStorage (void);
  153.  
  154. HFONT far pascal SelectFont (HDC hDC, HFONT hFont);
  155. BOOL far pascal PickEmacsFont (void);
  156. void far pascal FontInit (void);
  157.